<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org">
	
	<head th:include="/common/shop_common :: source"></head>
	
	<body>
	<div th:include="/common/shop_common :: header"></div>
	<!--banner-->
	<div class="banner-top">
		<div class="container">
			<h2 class="animated wow fadeInLeft" data-wow-delay=".5s">注册用户</h2>
			<h3 class="animated wow fadeInRight" data-wow-delay=".5s"><a href="index.html">Home</a><label>/</label>Products<label>/</label>Women's</h3>
			<div class="clearfix"> </div>
		</div>
	</div>
	<!-- contact -->
	<div class="login">
		<div class="container">
		<form th:action="@{/user/customerRegister}" id="dataForm" th:method="post" onsubmit="return check(this)">
			<div class="col-md-6 login-do1 animated wow fadeInLeft" data-wow-delay=".5s">
				<div class="login-mail">
					<input type="text" name="username" placeholder="用户名" required="">
					<i class="glyphicon glyphicon-user"></i>
				</div>
				<div class="login-mail">
					<input type="password" name="password" placeholder="密码" required="">
					<i class="glyphicon glyphicon-lock"></i>
				</div>
				<div class="login-mail">
					<input type="password" name="againPassword" placeholder="重复密码" required="">
					<i class="glyphicon glyphicon-lock"></i>
				</div>
				<div class="login-mail">
					<input type="text" name="email" placeholder="邮箱" required="">
					<i class="glyphicon glyphicon-envelope"></i>
				</div>
				<div class="login-mail">
					<input type="text" name="phone" placeholder="手机号" required="">
					<i class="glyphicon glyphicon-earphone"></i>
				</div>
				<div class="login-mail">
					<input type="text" name="address" placeholder="家庭地址" required="">
					<i class="glyphicon glyphicon-home"></i>
				</div>
				<a class="news-letter" href="#">
					<label class="checkbox1">
					<input type="checkbox" name="checkbox" >
					<i></i>我同意入住协议</label>
				</a>
			</div>
			<div class="col-md-6 login-do animated wow fadeInRight" data-wow-delay=".5s">
				<label class="hvr-sweep-to-top login-sub">
					<input id="submit" type="submit" value="点击提交">
					</label>
					<p>您已注册</p>
				<a href="login.html" class="hvr-sweep-to-top">立即登陆</a>
			</div>
			<div class="clearfix"> </div>
			</form>
			<input type="hidden" id="code" value="${code}"></input>
			<input type="hidden" id="msg" value="${msg}"></input>
		</div>
	</div>
	<div class="social animated wow fadeInDown" data-wow-delay=".1s">
		<div class="container">
			<div class="col-sm-3 social-ic">
				<a href="#">关于我们</a>
			</div>
			<div class="col-sm-3 social-ic">
				<a href="#">私信客服</a>
			</div>
			<div class="col-sm-3 social-ic">
				<a href="#">商业合作</a>
			</div>
			<div class="col-sm-3 social-ic">
				<a href="#">其他帮助</a>
			</div>
			<div class="clearfix"></div>
		</div>
	</div>
	<script type="text/javascript">
		$(function(){
			
		})
		function check(form){
			var success = false;
			if(form.password.value == form.againPassword.value){
				var username = form.username.value;
				$.ajax({  
		            type: 'post',  
		            dataType: 'json',  
		            url: basePath + '/user/checkUserRegis',  
		            data: {
		            	username:username
		            }, 
		            async: false,  
		            success: function (data) {
		            	if(data.code!="200"){
		            		layer.msg(data.msg, {icon: 4});
		            	}else{
		            		layer.msg('欢迎'+form.username.value+"注册成功", {icon: 1});
		            		success =  true;
		            	}
		            }  
		        });
			}else{
				layer.msg('两次密码不正确', {icon: 4});
			}
			return success;
		}
	</script>
</body>
</html>